﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SqlImEx.Sql
{
    public class TableDefinition
    {
        public string name { get; set; }

        public string schema { get; set; }

        public Field[] Field { get; set; }

        public string FullyQualifiedSqlName
        {
            get
            {
                if (string.IsNullOrEmpty(schema))
                    return string.Format("[{0}]", name);
                return string.Format("[{0}].[{1}]", schema, name);
            }
        }

        public string FullSqlName
        {
            get
            {
                if (string.IsNullOrEmpty(schema))
                    return string.Format("{0}", name);
                return string.Format("{0}.{1}", schema, name);
            }
        }

        public override string ToString()
        {
            return FullSqlName;
        }

    }
}
